package org.example;

import com.typesafe.config.ConfigFactory;
import org.apache.pekko.actor.ActorRef;
import org.apache.pekko.actor.ActorSystem;
import org.example.inter.Productable;
import org.example.rpc.RpcActor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @className: CarFactory
 * @Description:
 * @Author: wangyifei
 * @Date: 2025/3/13 10:58
 */
public class CarFactory implements Productable {
    private static Logger logger = LoggerFactory.getLogger(CarFactory.class);
    private ActorRef actorRef;
    public CarFactory(){
    }
    {
        start();
    }
    public void start(){
        ActorSystem actorSystem = ActorSystem.create(ContantVariable.PEKKO_SYSTEM_NAME, ConfigFactory.load());
        this.actorRef = actorSystem.actorOf(RpcActor.props(this),ContantVariable.FACTORY_URL);
    }
    @Override
    public void produce() {
        System.out.println("Car factory produce!!");
    }
}
